package com.flot.yazb.model.nearly;

import com.flot.yazb.base.BApplication;
import com.flot.yazb.base.model.BModel;
import com.flot.yazb.base.client.RetrofitFactory;
import com.flot.yazb.aop.stub.RMCallback;
import com.flot.yazb.aop.stub.RMResponse;
import com.flot.yazb.home.moudle.message.adapter.ChatMessageAdapter;
import com.flot.yazb.retrofit.service.BService;
import com.ydl.ahibernate.annotation.Column;
import com.ydl.ahibernate.annotation.Id;
import com.ydl.ahibernate.annotation.Table;

import java.util.List;

@Table(name = "t_msg")
public class TranslatingModel extends BModel {

    public List<TranslatingModel> cachedList;

    public static void transPeople(String id,final Transit<TranslatingModel[]> incubator) {
        RetrofitFactory.getInstance()
                .create(BService.UserService.class)
                .transPeople(id)
                .enqueue(new RMCallback<RMResponse<TranslatingModel[]>>(incubator.getContext()) {
                    @Override
                    protected void onSuccess(RMResponse<TranslatingModel[]> result) {
                        incubator.onBorn(result.content, result.code(), result.message());
                    }

                    @Override
                    protected void onFail(String errorCode, String errorInfo) {
                        incubator.onBorn(null, errorCode, errorInfo);
                    }
                });
    }

    @Id
    @Column(name = "id")
    private int id;

    @Column(name = "mid")
    public String mid;

    @Column(name = "selfid")
    public String selfid= BApplication.getInstance().getUserModel().id;//我的id

    @Column(name = "name", length = 20)
    public String name;

    @Column(name = "thumb")
    public String thumb;

    @Column(name = "type")
    public int type= ChatMessageAdapter.TYPE_RIGHT;

    public String height;
    public String url;
    public int age;
    public String city;
    public String province;
    public String content;
    public String time;
    public boolean isRead=false;
    public List<String> images;
    public boolean isShowPic=false;

    public TranslatingModel(int type, String time, String text) {
        this.type = type;
        this.time = time;
        this.content = text;
    }

}
